home *** CD-ROM | disk | FTP | other *** search
/ PC Player 2004 May / pc player 2004-05.iso / Demos / FarCry / Data1.cab / _AA35A0596B754D97A5D4FBCB21083C5F < prev    next >
Encoding:
Text File  |  2004-01-06  |  7.2 KB  |  234 lines

  1. --------------------------------------------------
  2. --    Created By: <your_name>
  3. --   Description: <short_description>
  4. --------------------------
  5. --
  6.  
  7. AIBehaviour.MutantCoverAttack = {
  8.     Name = "MutantCoverAttack",
  9.  
  10. counter = 0,
  11.  
  12.     -- SYSTEM EVENTS            -----
  13.     ---------------------------------------------
  14.     OnNoTarget = function( self, entity )
  15.         -- called when the enemy stops having an attention target
  16.         AI:Signal(SIGNALID_READIBILITY, 1, "STAY_ALERT",entity.id);        
  17.  
  18.         
  19.     end,
  20.  
  21.     ---------------------------------------------
  22.     OnCloseContact = function ( self, entity, sender)
  23.         local rnd=random(1,5);
  24.         --System:LogToConsole("\001 CLOSE CONTACT");
  25.         entity:InsertMeleePipe("attack_melee"..rnd);
  26.         --entity:InsertSubpipe(0,"m_c_melee_attack");
  27.     end,
  28.  
  29.     ---------------------------------------------
  30.     OnPlayerSeen = function( self, entity, fDistance )
  31.  
  32.         entity:SelectPipe(0,"m_c_rush_target");        
  33.  
  34.         if (fDistance>10) then 
  35.             entity:SelectPipe(0,"m_c_shoot");
  36.         end
  37.  
  38.         AI:Signal(SIGNALID_READIBILITY, 1, "THREATEN",entity.id);
  39.         
  40.         entity:InsertSubpipe(0,"DropBeaconAt");
  41.         
  42.     end,
  43.     ---------------------------------------------
  44.     OnEnemyMemory = function( self, entity )
  45.         -- rush to the player position
  46.         if (entity.AI_RocketDanger) then 
  47.             entity:StartAnimation(0,"NULL",4);
  48.             entity:SelectPipe(0,"DropBeaconAt");
  49.             entity:SelectPipe(0,"m_c_rush_target");        
  50.         end
  51.         AI:Signal(SIGNALID_READIBILITY, 1, "ENEMY_TARGET_LOST",entity.id);
  52.     end,
  53.  
  54.     ---------------------------------------------
  55.     OnGrenadeSeen = function( self, entity, fDistance )
  56.         -- called when the enemy hears a scary sound
  57.         entity:InsertSubpipe("devalue_target");
  58.     end,
  59.  
  60.     
  61.     ---------------------------------------------
  62.     OnInterestingSoundHeard = function( self, entity )
  63.         -- called when the enemy hears an interesting sound
  64.     end,
  65.     ---------------------------------------------
  66.     OnThreateningSoundHeard = function( self, entity )
  67.         -- called when the enemy hears a scary sound
  68.     end,
  69.     ---------------------------------------------
  70.     OnReload = function( self, entity )
  71.         -- called when the enemy goes into automatic reload after its clip is empty
  72.     end,
  73.     ---------------------------------------------
  74.     OnGroupMemberDied = function( self, entity )
  75.         -- called when a member of the group dies
  76.         AI:Signal(SIGNALID_READIBILITY, 2, "RESPOND_DOWN",entity.id);
  77.         
  78.     end,
  79.     ---------------------------------------------
  80.     OnNoHidingPlace = function( self, entity, sender )
  81.         -- called when no hiding place can be found with the specified parameters
  82.         entity:SelectPipe(0,"mutant_cover_cover");        
  83.     end,    
  84.     --------------------------------------------------
  85.     OnNoFormationPoint = function ( self, entity, sender)
  86.         -- called when the enemy found no formation point
  87.     end,
  88.     ---------------------------------------------
  89.     OnReceivingDamage = function ( self, entity, sender)
  90.         -- called when the enemy is damaged
  91. --        if (entity.AI_RocketDanger==nil) then
  92.             entity:StartAnimation(0,"NULL",4);
  93.             entity:InsertSubpipe(0,"m_c_quickhide");
  94. --        end
  95.  
  96.     end,
  97.     ---------------------------------------------
  98.     OnCoverRequested = function ( self, entity, sender)
  99.         -- called when the enemy is damaged
  100.     end,
  101.     
  102.     --------------------------------------------------
  103.     OnBulletRain = function ( self, entity, sender)
  104.         -- called when the enemy detects bullet trails around him
  105.     end,
  106.     --------------------------------------------------
  107.  
  108.     RUSH_TARGET = function (self, entity, sender)
  109.         entity:SelectPipe(0,"m_c_rush_target");
  110.     end,
  111.  
  112.     -- GROUP SIGNALS
  113.     ---------------------------------------------    
  114.     MUTANT_COVER_UP = function (self, entity, sender)
  115.         entity.cnt.AnimationSystemEnabled = 0;
  116.         entity.isSelfCovered = 1;
  117.         entity:StartAnimation(0,"ballup_stay",0,0.1,1);
  118.     end,
  119.     ---------------------------------------------    
  120.     MUTANT_COVER_DOWN = function (self, entity, sender)
  121.     
  122.         if(entity.isSelfCovered == 0) then return end
  123.         entity.cnt.AnimationSystemEnabled = 1;    
  124.         entity.isSelfCovered = 0;
  125.         entity:StartAnimation(0,"sidle",0,0.1,1);
  126.     end,
  127.     
  128.     ---------------------------------------------    
  129.     MUTANT_CLOSE_ATTACK = function (self, entity, sender)
  130.         local rnd = random(1,25);
  131.         
  132. --        entity:SelectPipe(0,"mutant_cover_close_attack");        
  133. --        do return end
  134.         
  135.         if (rnd<10) then
  136.             entity.lastMeleeAttackTime = _time + 3;                    -- don't do close attack in next 3 seconds
  137.             AI:Signal(0, 1, "MUTANT_BACKOFF_ATTACK",entity.id);
  138.         else
  139.             entity:SelectPipe(0,"mutant_cover_close_attack");
  140.         end
  141.     end,
  142.     
  143.     ---------------------------------------------    
  144.     MUTANT_NORMAL_ATTACK = function (self, entity, sender)
  145.  
  146. --        if(self.counter    == 1) then
  147. --            self.counter = 0;
  148. --            entity:SelectPipe(0,"mutant_cover_close_attack");
  149. --        else
  150. --            self.counter = 1;
  151. --            entity:SelectPipe(0,"mutant_standard_attack");
  152. --        end
  153. --do return end;
  154.  
  155.         AI:Signal(0, 1, "MUTANT_COVER_DOWN",entity.id);
  156.         
  157.         local rnd = random(1,25);
  158. --        if (rnd<5 and entity.suppressedValue<entity.Properties.suppressedThrhld*.6) then
  159.         if (rnd<7 and entity.cnt:CounterGetValue("SuppressedValue")<entity.Properties.suppressedThrhld*.6) then
  160.             
  161.             entity:SelectPipe(0,"mutant_cover_close_attack");
  162. --        elseif (rnd<10) then
  163. --            entity:SelectPipe(0,"mutant_standard_attack");    
  164.         elseif (rnd<15) then
  165.             entity:SelectPipe(0,"mutant_cover_attack");
  166.         else
  167.             entity:SelectPipe(0,"mutant_cover_strafe");
  168.         end
  169.     end,
  170.  
  171.     ---------------------------------------------    
  172.     MUTANT_BACKOFF_ATTACK = function (self, entity, sender)
  173.  
  174.         AI:Signal(0, 1, "MUTANT_COVER_DOWN",entity.id);
  175.         
  176.         local rnd = random(1,20);
  177.         if (rnd<5) then
  178.             entity:SelectPipe(0,"mutant_cover_backoffattack");
  179.         elseif (rnd<10) then
  180.             entity:SelectPipe(0,"mutant_standard_attack");
  181.         else
  182.             entity:SelectPipe(0,"mutant_cover_strafe");
  183.         end
  184.     end,
  185.  
  186.  
  187.     ---------------------------------------------    
  188.     MUTANT_COVER_STRAFE = function (self, entity, sender)
  189.         local rnd = random(1,20);
  190.         if (rnd<10) then
  191.             entity:InsertSubpipe(0,"mutant_cover_strafe_right");
  192.         else    
  193.             entity:InsertSubpipe(0,"mutant_cover_strafe_left");    
  194.         end    
  195.     end,
  196.  
  197.     ---------------------------------------------
  198.     MUTANT_COVER_SUPPRESSED = function( self, entity )
  199.     
  200.         
  201. --        if(entity.suppressedValue < entity.Properties.suppressedThrhld) then return end
  202.         if(entity.cnt:CounterGetValue( "SuppressedValue" ) < entity.Properties.suppressedThrhld) then return end        
  203.  
  204.         entity:SelectPipe(0,"mutant_cover_cover");
  205.         entity.cnt:CounterSetValue( "SuppressedValue", entity.Properties.suppressedThrhld*.2);
  206. --        entity.suppressedValue = entity.Properties.suppressedThrhld*.2;
  207.         
  208.     end,
  209.     
  210.     ---------------------------------------------
  211.     MUTANT_COVER_HUNT = function( self, entity )
  212.         -- called when the enemy can no longer see its foe, but remembers where it saw it last
  213.     
  214. --System:Log("\001 MUTANT_COVER_HUNT <<<<<<<<<<<<<");    
  215.         
  216.         AI:Signal(0, 1, "MUTANT_COVER_DOWN",entity.id);        
  217.         
  218.         local rnd = random(1,15);
  219.         if (rnd<5) then
  220.             entity:SelectPipe(0,"mutant_cover_hunt");        
  221.         elseif( rnd<10 )    then
  222.             entity:SelectPipe(0,"mutant_cover_strafe_hunt_left");            
  223.         else
  224.             entity:SelectPipe(0,"mutant_cover_strafe_hunt_right");            
  225.         end    
  226.             
  227.     end,
  228.     
  229.     ---------------------------------------------
  230.  
  231.     
  232.     
  233.     
  234. }